package com.guchenbo.example.sasl;

import java.security.Provider;
import java.security.Security;

public class SecurityProvidersExample {
    public static void main(String[] args) {
        Provider[] providers = Security.getProviders();

        if (providers != null && providers.length > 0) {
            for (Provider provider : providers) {
                System.out.println("Provider Name: " + provider.getName());
                System.out.println("Provider Info: " + provider.getInfo());
                System.out.println("Provider Version: " + provider.getVersion());

                // 列出此提供者支持的算法
                for (Provider.Service service : provider.getServices()) {
                    System.out.println("Algorithm: " + service.getAlgorithm());
                    System.out.println("Type: " + service.getType());
                }
                System.out.println();
            }
        } else {
            System.out.println("没有安全提供者注册。");
        }
    }
}

